/* Y o u r   D e s c r i p t i o n                       */
/*                            AppBuilder Photon Code Lib */
/*                                         Version 2.01  */

/* Standard headers */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

/* Local headers */
#include "ablibs.h"
#include "abimport.h"
#include "proto.h"

#include "trenddb.h"
#include "plcdb.h"

int
shutdown_btn ( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
	char const *btns[] = { "&Выключить компьютер", "&Отмена" };

	/* eliminate 'unreferenced' warnings */
	widget = widget, apinfo = apinfo, cbinfo = cbinfo;

	trenddb_flush (myself, hist);
//	plcdb_flush ();

	switch (PtAlert (NULL, NULL, NULL, NULL, 
			"Закрыть программу и выключить компьютер ?",
			NULL,
           	2, btns, NULL, 2, 2, Pt_BLOCK_ALL ) ) 
    {
	    case 1:
			system ("slay -f daq_srv");
			//system ("slay -f trenddb");
			//system ("slay -f plcdb");
			system ("phshutdown -S system");
	        break; 
	    case 2:
	        break;
	}
	return( Pt_CONTINUE );
}

